/* prhw.t  prh_hist Purchase Order Receipt History Write Trigger              */
/*Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                         */
/*All rights reserved worldwide.  This is an unpublished work.                */
/* $Revision: 1.6 $                                                           */
/*V8:ConvertMode=NoConvert                                                    */
/******************************************************************************/
/* Revision: 1.3        BY: Jean Miller          DATE: 06/06/02  ECO: *P07T*  */
/* Revision: 1.5        BY: Jean Miller          DATE: 06/13/02  ECO: *P082*  */
/* $Revision: 1.6 $     BY: Jean Miller          DATE: 08/01/02  ECO: *P0CL*  */
/******************************************************************************/

TRIGGER PROCEDURE FOR WRITE OF prh_hist OLD BUFFER old_prh_hist.

{mfdeclre.i}

define new shared work-table wf_old_prh_hist like prh_hist.

define variable l-return as character no-undo.

/* Track Capacity Units */
if new prh_hist and
  (old_prh_hist.prh_nbr      <> prh_hist.prh_nbr      or
   old_prh_hist.prh_receiver <> prh_hist.prh_receiver or
   old_prh_hist.prh_line     <> prh_hist.prh_line)
then do:

   if prh_hist.prh_qty_ord < 0 then
      l-return = "RETURN".
   else
      l-return = "".

   {lvucap.i &TABLE="prh_hist" &QUALIFIER="l-return"}

end.

/* fdn 2004/10/28 Modify Record processing */
HK:
do:
    if can-find(first dt_mstr where dt_table = "prh_hist" and dt_type = "SYNC") then
        run CreateSyncFlag(input "MOD", input recid(prh_hist), input "prh_hist").

    if not can-find ( first dt_mstr where dt_table = "prh_hist" and dt_type = "MOD" ) then leave HK.
    
    if not can-find ( first wf_old_prh_hist ) then do:
        create wf_old_prh_hist.
        if recid(wf_old_prh_hist)= -1 then .
    end.
    
    buffer-copy old_prh_hist to wf_old_prh_hist no-error.

    for each dt_mstr no-lock where dt_table = "prh_hist" and dt_type = "MOD" :
    
        case dt_field :

            when "prh_part" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_part, input prh_hist.prh_part,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_nbr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_nbr, input prh_hist.prh_nbr,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_line" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_line), input string(prh_hist.prh_line),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_rcvd" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_rcvd), input string(prh_hist.prh_rcvd),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_pur_cost" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_pur_cost), input string(prh_hist.prh_pur_cost),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_pur_std" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_pur_std), input string(prh_hist.prh_pur_std),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_rcp_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_rcp_date), input string(prh_hist.prh_rcp_date),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_vend" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_vend, input prh_hist.prh_vend,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_receiver" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_receiver, input prh_hist.prh_receiver,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_lot" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_lot, input prh_hist.prh_lot,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_ps_nbr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_ps_nbr, input prh_hist.prh_ps_nbr,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_ps_qty" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_ps_qty), input string(prh_hist.prh_ps_qty),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_bo_qty" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_bo_qty), input string(prh_hist.prh_bo_qty),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__qadc02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__qadc02, input prh_hist.prh__qadc02,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_xinvoice" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_xinvoice, input prh_hist.prh_xinvoice,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_xinv_dt" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_xinv_dt), input string(prh_hist.prh_xinv_dt),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__qadd01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__qadd01), input string(prh_hist.prh__qadd01),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_xinv_cst" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_xinv_cst), input string(prh_hist.prh_xinv_cst),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__qadc03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__qadc03, input prh_hist.prh__qadc03,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__qadc04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__qadc04, input prh_hist.prh__qadc04,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__qadc05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__qadc05, input prh_hist.prh__qadc05,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_rev" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_rev, input prh_hist.prh_rev,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_type, input prh_hist.prh_type,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_print" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_print), input string(prh_hist.prh_print),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_lbr_std" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_lbr_std), input string(prh_hist.prh_lbr_std),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_mtl_std" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_mtl_std), input string(prh_hist.prh_mtl_std),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_bdn_std" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_bdn_std), input string(prh_hist.prh_bdn_std),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_sub_std" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_sub_std), input string(prh_hist.prh_sub_std),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_buyer" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_buyer, input prh_hist.prh_buyer,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__qad03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__qad03), input string(prh_hist.prh__qad03),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__qad02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__qad02, input prh_hist.prh__qad02,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_shipto" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_shipto, input prh_hist.prh_shipto,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_cst_up" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_cst_up), input string(prh_hist.prh_cst_up),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_um" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_um, input prh_hist.prh_um,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_um_conv" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_um_conv), input string(prh_hist.prh_um_conv),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_curr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_curr, input prh_hist.prh_curr,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_ex_rate" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_ex_rate), input string(prh_hist.prh_ex_rate),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_curr_amt" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_curr_amt), input string(prh_hist.prh_curr_amt),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_pay_um" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_pay_um, input prh_hist.prh_pay_um,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_pum_conv" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_pum_conv), input string(prh_hist.prh_pum_conv),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_user1" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_user1, input prh_hist.prh_user1,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_user2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_user2, input prh_hist.prh_user2,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_ovh_std" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_ovh_std), input string(prh_hist.prh_ovh_std),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_site" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_site, input prh_hist.prh_site,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_ship" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_ship, input prh_hist.prh_ship,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_qty_ord" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_qty_ord), input string(prh_hist.prh_qty_ord),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_per_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_per_date), input string(prh_hist.prh_per_date),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_rcp_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_rcp_type, input prh_hist.prh_rcp_type,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_reason" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_reason, input prh_hist.prh_reason,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_request" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_request, input prh_hist.prh_request,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_approve" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_approve, input prh_hist.prh_approve,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__qad04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__qad04), input string(prh_hist.prh__qad04),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_tax_at" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_tax_at, input prh_hist.prh_tax_at,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__chr01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__chr01, input prh_hist.prh__chr01,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__chr02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__chr02, input prh_hist.prh__chr02,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__chr03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__chr03, input prh_hist.prh__chr03,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__chr04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__chr04, input prh_hist.prh__chr04,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__chr05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__chr05, input prh_hist.prh__chr05,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__chr06" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__chr06, input prh_hist.prh__chr06,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__chr07" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__chr07, input prh_hist.prh__chr07,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__chr08" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__chr08, input prh_hist.prh__chr08,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__chr09" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__chr09, input prh_hist.prh__chr09,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__chr10" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__chr10, input prh_hist.prh__chr10,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__dte01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__dte01), input string(prh_hist.prh__dte01),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__dte02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__dte02), input string(prh_hist.prh__dte02),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__dte03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__dte03), input string(prh_hist.prh__dte03),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__dte04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__dte04), input string(prh_hist.prh__dte04),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__dte05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__dte05), input string(prh_hist.prh__dte05),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__dec01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__dec01), input string(prh_hist.prh__dec01),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__dec02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__dec02), input string(prh_hist.prh__dec02),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__dec03" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__dec03), input string(prh_hist.prh__dec03),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__dec04" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__dec04), input string(prh_hist.prh__dec04),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__dec05" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__dec05), input string(prh_hist.prh__dec05),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__log01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__log01), input string(prh_hist.prh__log01),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__log02" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__log02), input string(prh_hist.prh__log02),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_rma_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_rma_type, input prh_hist.prh_rma_type,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_fix_rate" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_fix_rate), input string(prh_hist.prh_fix_rate),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_po_site" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_po_site, input prh_hist.prh_po_site,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_cum_req" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_cum_req), input string(prh_hist.prh_cum_req),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_cum_rcvd" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_cum_rcvd), input string(prh_hist.prh_cum_rcvd),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_fsm_type" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_fsm_type, input prh_hist.prh_fsm_type,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_bank" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_bank, input prh_hist.prh_bank,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_curr_rlse_id[1]" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_curr_rlse_id[1], input prh_hist.prh_curr_rlse_id[1],
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_element" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_element, input prh_hist.prh_element,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_fix_pr" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_fix_pr), input string(prh_hist.prh_fix_pr),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_tax_usage" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_tax_usage, input prh_hist.prh_tax_usage,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_tax_env" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_tax_env, input prh_hist.prh_tax_env,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_crt_int" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_crt_int), input string(prh_hist.prh_crt_int),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_tax_in" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_tax_in), input string(prh_hist.prh_tax_in),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_taxc" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_taxc, input prh_hist.prh_taxc,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_vend_lot" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_vend_lot, input prh_hist.prh_vend_lot,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_ship_date" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_ship_date), input string(prh_hist.prh_ship_date),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__qadi01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh__qadi01), input string(prh_hist.prh__qadi01),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_ex_rate2" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_ex_rate2), input string(prh_hist.prh_ex_rate2),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_ex_ratetype" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh_ex_ratetype, input prh_hist.prh_ex_ratetype,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh_exru_seq" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input string(wf_old_prh_hist.prh_exru_seq), input string(prh_hist.prh_exru_seq),
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__qadc06" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__qadc06, input prh_hist.prh__qadc06,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

            when "prh__qadc01" then
                run CreateDthist(input dt_table, input dt_field, input dt_type, input wf_old_prh_hist.prh__qadc01, input prh_hist.prh__qadc01,
                    input recid(prh_hist), input prh_hist.prh_nbr, input prh_hist.prh_receiver, input string(prh_hist.prh_line), input prh_hist.prh_element,
                    input "", input "", input "", input "").

        end.
    end.
end.

{hkdttrans.i}
